package com.situ.fly.dao;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import com.situ.fly.entity.User;

/**
 * 1、添加注解@Mapper
 * 
 * 
 * @author 周轩霆
 *
 */
@Mapper
public interface UserDao {
    /**
     * 
     * 根据用户名查询
     * 
     * 接口对象通过动态代理的方式创建，我们只需配置好sql语句
     * @Insert,Delete,Update,Select
     * 
     */
	@Select("select * from user where username=#{username}")
   User selectByUsername(String username);
     /* 根据昵称查询
     * 
     */
	@Select("select * from user where nickname=#{nickname}")
   User selectByNickname(String nickname);
    // * 插入用户信息
     //*/
	@Insert("insert into user (username,password,nickname) "
			+ "values( #{username},#{password},#{nickname})")
	int insert(User user);
	
}
